# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models


class Comment(models.Model):
    content = models.TextField()
    status = models.SmallIntegerField(default=1)  # 1 显示 0 删除
    create_time = models.DateTimeField(auto_now_add=True)
    update_time = models.DateTimeField(auto_now=True)

    user = models.ForeignKey('userModel.User', on_delete=models.CASCADE)
    article = models.ForeignKey('articleModel.Article', on_delete=models.CASCADE)
    parent = models.ForeignKey('self', on_delete=models.CASCADE, null=True)

    class Meta:
        db_table = 'comment'


class CommentLikeUer(models.Model):
    create_time = models.DateTimeField(auto_now_add=True)

    user = models.ForeignKey('userModel.User', on_delete=models.SET_NULL, null=True)
    comment = models.ForeignKey('Comment', on_delete=models.CASCADE)

    class Meta:
        db_table = 'comment_like_user'


